home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / fortran / peekpo.com / MACHIDM.FOR < prev    next >
Encoding:
Text File  |  1990-10-16  |  1.2 KB  |  36 lines

  1.       PROGRAM MACHINE_ID
  2.       integer*4 laddr/#FFFF000E/
  3.       integer*2 ibyte
  4. c
  5. c     This program is a demonstration of an all-Fortran PEEK routine.
  6. c     It will return the machine ID byte from address FFFF:000E;
  7. c     this location tells you whether your machine is a PC, an XT,
  8. c     or an AT.
  9. c
  10. c     Ignore the error message F2607 that is emitted by the Microsoft
  11. c     compiler - we're simply doing something that they don't understand.
  12. c     If it bothers you, then complile PEEKB0 apart from the rest of the
  13. c     code, and then link it in.
  14. c
  15.       call peekb(laddr,ibyte)
  16.       print 20, ibyte
  17.    20 format (' ibyte = ',z2)
  18. c
  19.       stop
  20.       end
  21.       INTERFACE TO SUBROUTINE PEEKB0(L,I)
  22.       integer*4 L [VALUE]
  23.       end
  24.       SUBROUTINE PEEKB(LADDR,IBYTE)
  25.       integer*4 laddr                   ! Address of byte to get
  26.       integer*2 ibyte                   ! Value of that location
  27.       call peekb0(laddr,ibyte)          ! Pass LADDR by value
  28.       ibyte=iand(ibyte,255)             ! Trim off extra byte
  29.       return
  30.       end
  31.       SUBROUTINE PEEKB0(I,IBYTE)
  32.       integer*2 i,ibyte
  33.       ibyte=i                           ! Get what's there
  34.       return
  35.       end
  36.